//
//  UIButton+conveninceInit.swift
//  MyBlog
//
//  Created by 李芙蓉 on 16/3/4.
//  Copyright © 2016年 hanlei. All rights reserved.
//

import UIKit

extension UIButton {

    convenience init(title:String, backgroundImageName:String, textColor:UIColor?=myTextColor) {
        
        self.init()
        
        setTitle(title, forState: .Normal)
        
        setBackgroundImage(UIImage(named: backgroundImageName), forState: .Normal)
        
        if let t = textColor {
            
            setTitleColor(t, forState: .Normal)
            
            setTitleColor(myOrangeColor, forState: .Highlighted)
        }
    }
}